A web browser is a software application that identifies and retrieves information resources from the World Wide Web using Uniform Resource Locators (URLs) or Uniform Resource Identifiers (URIs) for the information resources. Examples of the retrieved information resources include webpages, images, videos, and other content. Hypertext Markup Language (HTML) is a markup language for composing webpages. The HTML source code for a webpage specifies the layout and appearance of text, images, and objects to be embedded in the webpage, for example. A layout engine of the web browser transforms the HTML source code and associated information resources (e.g., images, sounds, cascading style sheets, and so on) into an interactive document that is displayed in a browser window. Hyperlinks present in the webpage enable a user to navigate to related resources (e.g., other webpages) using the web browser.
Sometimes, the HTML source code for a webpage also includes or references program scripts that affect the behavior of the web browser. JavaScript is a scripting language that can be used for creating interactive webpages. A use of program scripts in an HTML document is to write functions that interact with the Document Object Model (DOM) of the webpage. Examples of this usage include opening new windows, validating web form input values, changing images in response to cursor movements, and so on. Because embedded scripts (e.g., JavaScript code embedded in an interactive webpage) run locally in a user's browser (rather than on a remote server), they respond to user actions quickly, making a web application feel more responsive.
JavaScript source code can be interpreted directly by a JavaScript engine of a web browser and executed in a virtual machine environment. Sometimes, the JavaScript source code is first compiled into an intermediate representation, known as the bytecode. The bytecode is then interpreted and executed in the virtual machine environment. Bytecode interpretation improves runtime performance over direct source code interpretation. Sometimes, JavaScript source code or bytecode is compiled into native machine code, and the machine code is executed natively to further improve runtime performance.